package cn.zhizihua.controller;

import cn.zhizihua.pojo.Food;
import cn.zhizihua.query.FoodQuery;
import cn.zhizihua.service.IFoodService;
import cn.zhizihua.vo.ResultBean;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


/**
 * 餐品模块
 * 控制类
 */
@Api(value = "餐品的API",description="餐品相关的CRUD功能")
@RestController
@RequestMapping("/food")   //模块路径
public class FoodController extends BaseController<Food,FoodQuery>{

    @Autowired
    IFoodService foodService;


    /*
    TODO 这里修改了business为getByBId 写前端页面时注意
    根据商家编号查询该商家的所有餐品
     */
    @ApiOperation(value = "通过商家id查询餐品信息")
    @GetMapping("/getByBId/{bid}")    //  get  /food/business/1
    public ResultBean getByBusinessId(@PathVariable("bid") Integer businessId){
        System.out.println("---------FoodController--------getByBusinessId-----------");
        System.out.println(businessId);
        return foodService.getByBusinessId(businessId);
    }
}
